$(document).ready(function(){
	access_token = $.getCookie("access_token");
	var money = undefined;
	//获取用户信息
	$.getJSON("/"+server+"/UserGet?access_token="+access_token+requestLast,function(json){
		if(json.result == 1){
			money = parseFloat(json.user.money)-parseFloat(json.user.presentMoney);
			$('.money').text(money+"元");
		}
	})

	$.linkToRecord = function(){
		window.location.href="/"+server+"/userMoney?type=4&isShow=1";
	}
	//点击提现
	$('.pickup-button').bind('click',function(){

		var pickupMoney = parseFloat($('.pickup-money').val());
		//判断输入文本是否数字
		if(isNaN($('.pickup-money').val()) || $('.pickup-money').val() == ""){
			$.popTagShow(1,"提现金额填写错误","请输入准备提现金额",null,null,null,null,"确定",$.popTagHide);
			return false;
		}
		//判断提现金额是否大于可提现金额
		if(pickupMoney <= money){
			//请求提现接口
			$.getJSON("/"+server+"/cashPickup?access_token="+access_token+"&cashPickup="+pickupMoney+requestLast,function(json){
				if(json.result == 1){
					money = money-pickupMoney;
					$('.money').text(money+"元");
					$.popTagShow(3,"提现成功",null,null,null,null,null,null);
					//跳转到提现详情页面
					setTimeout("$.linkToRecord()",5000);
				}
				else{
					$.popTagShow(1,"提现失败","请重新提现",null,null,null,null,"确定",$.popTagHide);
				}
			})
		}
		else{
			$.popTagShow(1,"提现金额大于可提现金额","请输入准备提现金额",null,null,null,null,"确定",$.popTagHide);
		}		
	})
})